<table class="table table-bordered table-striped">
  <thead>
    <tr>
      <% if params[:recommand][:group] == 'recommander_id' %>
        <th>推荐人</th>
        <th>联系方式</th>
      <% else %>
        <th>终端</th>
      <% end %>
      <th>推荐数量</th>
      <% if @level_mode %>
        <th>用户组级别划分</th>
        <th>之前级别</th>
        <th>级别变动</th>
        <th>变化后级别</th>
      <% end %>
    </tr>
  </thead>
  <tbody>
  <% @recommands.each do |recommand| %>
    <tr id='recommand-<%= recommand.send(params[:recommand][:group]) %>'>
      <% if params[:recommand][:group] == 'recommander_id' %>
        <th><%= recommand.recommander.name %></th>
        <th><%= recommand.recommander.mobile_number %></th>
      <% else %>
        <th><%= recommand.terminal %></th>
      <% end %>   
      <td><%= recommand.respond_to?(:total) ? recommand.total : 0 %></td>
      <% if @level_mode %>
        <td><%= recommand.recommander.account_group.levels %></td>
        <td><%= recommand.recommander.level_before %></td>
        <td><%= recommand.recommander.level_change %></td>
        <td><%= recommand.recommander.level_after %><%= '<strong>(已调整)<strong>'.html_safe if @adjust_mode %></td>
      <% end %>
    </tr>
  <% end %>
  </tbody>
</table>